fix: preserve raw headers in dispatch handler bridge#5345
Merged
Conversation
Signed-off-by: Matteo Collina <hello@matteocollina.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v7.x #5345 +/- ##
==========================================
- Coverage 92.91% 92.90% -0.01%
==========================================
Files 112 112
Lines 35837 35843 +6
==========================================
+ Hits 33297 33299 +2
- Misses 2540 2544 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ronag
approved these changes
Jun 3, 2026
metcoder95
approved these changes
Jun 3, 2026
Merged
QuiiBz
added a commit
to vercel/sandbox
that referenced
this pull request
Jun 4, 2026
Closes #198 Update the Undici version we use to fix an issue where using Undici v7 `Agent` with a Undici v8 `fetch` (e.g. using Node.js 26 with the global, bundled `fetch`) would cause response headers to be dropped, and response body to not be decompressed Upstream Undici fix: nodejs/undici#5345
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Preserve
rawHeadersandrawTrailerson the synthetic controller used byUnwrapHandlerwhen bridging modern dispatch handlers to the legacy handler interface.This keeps Node.js bundled
fetchcompatible with an imported Undici v7Agent, so response headers remain visible and compressed bodies continue to be decoded.Fixes: #5341
Changes
rawHeaderson the controller before invokingonRequestUpgrade/onResponseStartrawTrailersbefore invokingonResponseEndtypes/dispatcher.d.tsfetchwith both the global dispatcher and an explicitdispatcher: new Agent()Testing
npm run lint -- lib/handler/unwrap-handler.js test/node-test/global-dispatcher-version.js types/dispatcher.d.tsnpx borp -p "test/node-test/global-dispatcher-version.js"source ~/.nvm/nvm.sh && nvm use 26.3.0 >/dev/null && npx borp -p "test/node-test/global-dispatcher-version.js"